In [4]:
n = 10
loc_data = np.zeros((n, 2))
loc_data[0] = np.array([12, 120])
loc_data[1] = np.array([56, 43])

In [5]:
loc_data


Out[5]:
array([[  12.,  120.],
       [  56.,   43.],
       [   0.,    0.],
       [   0.,    0.],
       [   0.,    0.],
       [   0.,    0.],
       [   0.,    0.],
       [   0.,    0.],
       [   0.,    0.],
       [   0.,    0.]])

In [6]:
class JetManager(object):
    def __init__(self, no):
        self.no = no
        self.lat = loc_data[no][0]
        self.lon = loc_data[no][1]

In [7]:
simman = Jet(0)

In [8]:
jet.lat


Out[8]:
12.0

In [9]:
jet.lon


Out[9]:
120.0

In [18]:
class Particle(object):
    def __init__(self, sourcejet):
        self.source = sourcejet
        self.pos = (self.source.lat, self.source.lon)
        self.origpos = self.pos.copy()
    def update_pos(self, newpos):
        self.pos = newpos

In [11]:
def convert_porco(old):
    return 180. - old - 3.5

In [12]:
def convert_porco2(old):
    return 180. - (old - 3.5)

In [16]:
input = np.arange(0, 360, 5)

In [17]:
for i, j,k in zip(input, convert_porco(input), convert_porco2(input)):
    print(i,j,k)


0 176.5 183.5
5 171.5 178.5
10 166.5 173.5
15 161.5 168.5
20 156.5 163.5
25 151.5 158.5
30 146.5 153.5
35 141.5 148.5
40 136.5 143.5
45 131.5 138.5
50 126.5 133.5
55 121.5 128.5
60 116.5 123.5
65 111.5 118.5
70 106.5 113.5
75 101.5 108.5
80 96.5 103.5
85 91.5 98.5
90 86.5 93.5
95 81.5 88.5
100 76.5 83.5
105 71.5 78.5
110 66.5 73.5
115 61.5 68.5
120 56.5 63.5
125 51.5 58.5
130 46.5 53.5
135 41.5 48.5
140 36.5 43.5
145 31.5 38.5
150 26.5 33.5
155 21.5 28.5
160 16.5 23.5
165 11.5 18.5
170 6.5 13.5
175 1.5 8.5
180 -3.5 3.5
185 -8.5 -1.5
190 -13.5 -6.5
195 -18.5 -11.5
200 -23.5 -16.5
205 -28.5 -21.5
210 -33.5 -26.5
215 -38.5 -31.5
220 -43.5 -36.5
225 -48.5 -41.5
230 -53.5 -46.5
235 -58.5 -51.5
240 -63.5 -56.5
245 -68.5 -61.5
250 -73.5 -66.5
255 -78.5 -71.5
260 -83.5 -76.5
265 -88.5 -81.5
270 -93.5 -86.5
275 -98.5 -91.5
280 -103.5 -96.5
285 -108.5 -101.5
290 -113.5 -106.5
295 -118.5 -111.5
300 -123.5 -116.5
305 -128.5 -121.5
310 -133.5 -126.5
315 -138.5 -131.5
320 -143.5 -136.5
325 -148.5 -141.5
330 -153.5 -146.5
335 -158.5 -151.5
340 -163.5 -156.5
345 -168.5 -161.5
350 -173.5 -166.5
355 -178.5 -171.5

In [30]:
import SpiceyPy as spice

In [32]:
spice.latrec(200000, -80, 10)


Out[32]:
array([  18524.55869571, -166788.73451584, -108804.22217787])

In [33]:
spice.latrec(200, -80, 10)


Out[33]:
array([  18.5245587 , -166.78873452, -108.80422218])

In [34]:
spice.reclat?

In [40]:
axes = np.array([250, 260, 270])
axes = axes*1000
point_i = spice.latrec(axes[2], np.deg2rad(170), np.deg2rad(-85))

In [39]:
spice.surfnm(axes[0], axes[1], axes[2], point_i)


Out[39]:
array([-0.0999795 ,  0.01629908, -0.99485599])

In [41]:
spice.surfnm(axes[0], axes[1], axes[2], point_i)


Out[41]:
array([-0.0999795 ,  0.01629908, -0.99485599])

In [42]:
np.where?

In [60]:
def _100_():
    import xlrd
    excelFile100sources = '/Users/klay6683/Dropbox/SternchenAndMe/Enceladus_stuff/100_sources_Porco2014.xlsx'
    book = xlrd.open_workbook(excelFile100sources)
    sh = book.sheet_by_index(0)
    # loop over columns in excel sheet
    lonlat = np.zeros((sh.nrows, 2))
    lonlat[:, 0] = sh.col_values(0)[:]
    lons = np.array(sh.col_values(1)[:])
#     ### LONGITUDES !!!
    lonlat[:,1]=180. - (lons - 3.5) # it is West Lon in the paper with different zero and in Voyager era            
    return lonlat

In [62]:
_100_()[:5]


Out[62]:
array([[ -75.82,  126.72],
       [ -75.93,  126.07],
       [ -76.25,  124.86],
       [ -76.81,  120.91],
       [ -77.56,  118.31]])

In [78]:
df = pd.read_excel('/Users/klay6683/Dropbox/SternchenAndMe/Enceladus_stuff/100_sources_Porco2014.xlsx',
                   header=None)
lonlat = df[[0,1]].values
lonlat[:, 1] = 180. - (lonlat[:, 1] - 3.5)

In [79]:
lonlat[:5]


Out[79]:
array([[ -75.82,  126.72],
       [ -75.93,  126.07],
       [ -76.25,  124.86],
       [ -76.81,  120.91],
       [ -77.56,  118.31]])

In [75]:
lonlat[:, 0]


Out[75]:
array([  56.78,   57.43,   58.64,   62.59,   65.19,   70.08,   81.4 ,
         83.31,   88.83,   98.01,  104.9 ,  116.3 ,  128.22,  135.22,
        146.37,  155.01,  161.11,  173.53,  176.84,  178.43,  183.83,
        180.39,  199.92,  201.  ,   33.31,   32.75,   30.2 ,   30.64,
         31.73,   29.44,   29.65,   25.96,   22.04,   17.36,   16.76,
         11.87,   11.5 ,    6.89,  358.17,  339.63,  322.42,  272.23,
        239.35,  232.38,  228.81,  226.93,  230.2 ,  228.28,  228.12,
        229.55,  227.42,  224.77,  225.61,   16.09,   18.  ,   13.81,
         13.78,   14.73,   15.8 ,  348.33,  343.99,  339.72,  336.33,
        332.02,  327.56,  323.82,  321.01,  314.97,  310.73,  304.77,
        302.85,  294.38,  291.57,  283.19,  277.06,  272.63,  263.8 ,
        260.62,  255.44,  251.73,  249.07,  246.77,  337.85,  337.2 ,
        336.59,  336.34,  333.09,  329.33,  116.16,  153.2 ,  156.72,
        164.46,  165.51,  184.81,  199.21,   33.13,   32.78,  131.55,
         30.85,  107.27])

In [76]:
lonlat[:, 0] = 180. - (lonlat[:, 0] -3.5)

In [77]:
lonlat[:5]


Out[77]:
array([[ 126.72,  -75.82],
       [ 126.07,  -75.93],
       [ 124.86,  -76.25],
       [ 120.91,  -76.81],
       [ 118.31,  -77.56]])

In [82]:
i=50
'jet'+str(i).zfill(2)


Out[82]:
'jet50'

l = False


In [84]:
check = 'False'

In [86]:
if check:
    print("yes")


yes

In [104]:
convert_porco2(62.59)


Out[104]:
120.91

In [93]:
convert_porco(58.64)


Out[93]:
117.86

In [110]:
lonlat[93]


Out[110]:
array([-74.1 ,  -1.31])

In [100]:
number2reset = 15000
lonlat_all = lonlat
dlon = np.zeros(number2reset)
dlon[:] = np.deg2rad(lonlat_all[3,1])
dlat = np.zeros(number2reset)
dlat[:] = np.deg2rad((lonlat_all[3,0]))
source_lat = dlat[0]
source_lon = dlon[0]

In [101]:
source_lon


Out[101]:
2.110277598586344

In [103]:
np.rad2deg(source_lon)


Out[103]:
120.91000000000001

In [115]:
convert_porco2(184.81)


Out[115]:
-1.3100000000000023

In [112]:
df.loc[93]


Out[112]:
0      -74.1
1     184.81
2       0.19
3          9
4        106
5        NAN
6        NAN
7          5
8          3
9          3
10     Cairo
11      0.17
Name: 93, dtype: object

In [123]:
lonlat[90:100]


Out[123]:
array([[ -73.17,   26.78],
       [ -70.56,   19.04],
       [ -69.58,   17.99],
       [ -74.1 ,   -1.31],
       [ -74.07,  -15.71],
       [ -72.99,  150.37],
       [ -74.04,  150.72],
       [ -75.95,   51.95],
       [ -71.24,  152.65],
       [ -73.94,   76.23]])

In [114]:
convert_porco2??

In [ ]: